<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 分组选择器 */
        div,h1,p{
            color: red;
        }
        /* 子代的元素类型不同时，可以使用nth-of-type() */
        body div:nth-of-type(2){
            background-color: blue;
        }
    </style>
</head>
<body>
    <div>div</div>
    <h1>h1</h1>
    <p>p</p>
    <div>div</div>
    <div>div</div>
</body>
</html>